Function: appendTo(domInsertionElement, domElementOrMarkupStringOrCSSSelector, functionCallback(domElement))
Description: Inserts a target DOM element at the end of an element, markup string, or CSS selector referenced element in the DOM.
Returns: domElement, or $A object if chained.
Note: The appendTo() function is the literal opposite of append().
Example:
// Insert a DOM element at the end of another element targetted with a CSS selector
var myElement = $A.appendTo("#myTargetNodeId", domElement);
// Insert a markup string element at the end of another DOM element
var myElement = $A.appendTo(domElement, '
Here we are now, entertain us.
');
// Insert one element referenced by a CSS selector at the end of another DOM element
var myElement = $A.appendTo(domElement, "#myTargetNodeToMove");
// Insert a DOM element at the end of another DOM element and exicute a callback when done
var myElement = $A.appendTo(domElementToTarget, domElementToMove, function(domElementToMove) {
// Do something with domElementToMove after the insertion is complete.
});
// Or the same using chaining
// Insert a DOM element at the end of another element targetted with a CSS selector
var myChain = $A(domElement).appendTo("#myTargetNodeId");
// Insert a markup string element at the end of another DOM element
var myChain = $A('Here we are now, entertain us.
').appendTo(domElement);
// Insert one element referenced by a CSS selector at the end of another DOM element
var myChain = $A("#myTargetNodeToMove").appendTo(domElement);
// Insert a DOM element at the end of another DOM element and exicute a callback when done
var myChain = $A(domElementToMove).appendTo(domElementToTarget, function(domElementToMove) {
// Do something with domElementToMove after the insertion is complete.
});
// To return the modified element within a chain, use the "return()" method.
var myElement = myChain.return();